package com.wzy.checkcode.controller;

import com.wzy.checkcode.config.SendEmailConfig;
import com.wzy.checkcode.service.EmailCodeService;
import com.wzy.checkcode.service.impl.EmailCodeServiceImpl;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author wzy
 * @Date 2024/2/1 16:08
 * @description: 邮箱验证码管理
 */
@Slf4j
@RestController
public class EmailCodeController {
    @Autowired
    private EmailCodeService  emailCodeService;
    @ApiOperation(value = "发送邮箱验证码", tags = "发送邮箱验证码")
    @PostMapping("/phone")
    public void sendEMail(@RequestParam("param1") String email) {
        String code = SendEmailConfig.achieveCode();
        log.info("发送的验证码为：{}",code);
        emailCodeService.sendEMail(email,code);
    }
}
